//
//  IdentiPersonVC.m
//  智慧小区
//
//  Created by 高永杨 on 2017/3/17.
//  Copyright © 2017年 zhongchuang. All rights reserved.
//

#import "IdentiPersonVC.h"
#import "IdentiPersonCell.h"
#import "IdentiSelecrPersonVC.h"
#import "UIViewController+extent.h"
@interface IdentiPersonVC ()<UITableViewDataSource,UITableViewDelegate>
@property (weak, nonatomic) IBOutlet UITableView *identiTableV;

@end
static NSString *cellId = @"cellId";
@implementation IdentiPersonVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"身份认证";
    self.tabBarController.tabBar.hidden = YES;
    [self createView];
    [self setNav:self];
    [self.identiTableV registerNib:[UINib nibWithNibName:NSStringFromClass([IdentiPersonCell class]) bundle:nil] forCellReuseIdentifier:cellId];
    // Do any additional setup after loading the view from its nib.
    
}
-(void)goBack
{
    [self.navigationController popViewControllerAnimated:YES];
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    IdentiPersonCell *idenCell = [tableView dequeueReusableCellWithIdentifier:cellId forIndexPath:indexPath];
    return idenCell;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
}

-(void)createView
{
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, GyyScreenW, 44)];
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(10, 0, 100, 30)];
    label.text = @"类型:";
    label.centerY = view.centerY;
    [view addSubview:label];
    UILabel *labelType = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, GyyScreenW/2, 30)];
    labelType.center = view.center;
    labelType.text = @"请选择身份类型";
    labelType.tag = 200;
    labelType.textAlignment = NSTextAlignmentCenter;
    [view addSubview:labelType];
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickType)];
    [view addGestureRecognizer:tapGesture];
    self.identiTableV.tableHeaderView = view;
}

-(void)clickType{
    if (![self.view viewWithTag:1001]) {
        IdentiSelecrPersonVC *personV = [[IdentiSelecrPersonVC alloc]init];
        personV.view.frame = CGRectMake(0, 0, GyyScreenW, GyyScreenH);
        personV.view.tag = 1001;
        __weak typeof(self) weakSelf = self;
        personV.myblock = ^(NSString *titleStr){
            UILabel *label = [weakSelf.view viewWithTag:200];
            label.text = titleStr;
        };
        personV.view.centerX = self.view.centerX;
        personV.view.centerY = self.view.centerY-64;
        [self addChildViewController:personV];
        [self.view addSubview:personV.view];
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
